<?php

namespace app\api\controller;

use app\api\model\Lang;

class Search extends Base
{
    /**
     * 首页搜索
     * @return array
     * @throws \think\Exception\DbException
     */
    public function index()
    {
        $search = input('search');
        if (empty($search)) {
            return self::sendResult(100, [], '请输入搜索内容');
        }

        $model = Lang::search($search);
        return self::sendResult(self::$okCode, $model);
    }
}